<?php
($user_id = session('user_id')) || abort('请先登录');
$page = _POST('page', 1);
$page_size = _POST('page_size', 10);
$start = ($page-1)*$page_size;
$limit = $page_size+1;

$log = $GLOBALS['db']
        ->getAll('SELECT pay_points,change_time,change_desc FROM '.$GLOBALS['ecs']->table('account_log')." WHERE user_id={$user_id} AND pay_points<>0 ORDER BY change_time DESC LIMIT {$start},{$limit}");

$has_more = 0;
if (count($log) > $page_size)
{
    $has_more = 1;
    array_pop($log);
}

return ['has_more' => $has_more, 'list' => $log];
